import sys
from pathlib import Path
# 获取当前执行脚本的路径
script_dir = Path(__file__).parent
# 获取 llmweb 模块的路径
llmweb_dir = script_dir.parent

# 将 llmweb 目录的路径添加到 sys.path
sys.path.append(str(llmweb_dir))

import llmweb
import asyncio

async def main():
    pool = llmweb.BrowserPool(headless=False, pool_size=1, workdir='pool')
    await pool.initialize()
    yiyan = llmweb.YiYanLLM(pool)
    # await yiyan.login()
    answer = yiyan.generate("你好，用100个字介绍下你自己")
    async for a in answer:
        print(a)
    await pool.close()
    
     
if __name__ == "__main__":
    asyncio.run(main())